import unittest
from blog import Blog
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template

import mox
import StringIO


class TestBlogFunctions(mox.MoxTestBase):
	def setUp(self):
		self.blog = Blog()
		self.blog.response = mox.MockObject(Blog)
		self.blog.response.out = mox.MockObject(StringIO.StringIO)
		template.render = self.mockedRender
		
	def mockedRender(self, template_path, template_dict, debug=False):
		self.template_dict = template_dict
		self.tempate_path = template_path
			
	def testWhenRequestingDefaultPage_ShouldGetIndexPage(self):
		
			
		self.blog.get()
		
		self.assertEqual('index.html', self.tempate_path[-10:])
		
		
def main():
    unittest.main()

if __name__ == '__main__':
	    main()